/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package teamRoom111;



import battlecode.common.*;
import static battlecode.common.GameConstants.*;

/**
 *
 * @author tulam4am
 */
public class WoutPlayer implements Runnable {

    private final RobotController rc;

    public WoutPlayer(RobotController rcInit) {
        rc = rcInit;
    }

    public void run()
    {
        while (true) {
            try {
                /*** beginning of main loop ***/
                while (rc.isMovementActive()) {
                    rc.yield();
                }

                if (rc.canMove(rc.getDirection())) {
                    rc.moveForward();
                } else {
                    rc.setDirection(rc.getDirection().rotateRight());

                }

                rc.yield();

            /*** end of main loop ***/
            } catch (Exception e) {
                System.out.println("caught exception:");
                e.printStackTrace();
            }
        }
    }

}
